package com.kofigyan.stateprogressbarsample;

import com.kofigyan.stateprogressbar.StateProgressBar;
import com.kofigyan.stateprogressbarsample.not_stateprogressbar.pojo.MenuItem;
import com.kofigyan.stateprogressbarsample.not_stateprogressbar.utils.ColorUtils;
import ohos.aafwk.content.Intent;

public abstract class BaseDescriptionActivity extends BaseAbility {

    String[] descriptionData = {"Details", "Status", "Photo", "Confirm"};
    protected StateProgressBar stateProgressBar;

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        stateProgressBar =
                (StateProgressBar) findComponentById(ResourceTable.Id_state_progress_bar);
        stateProgressBar.setStateDescriptionData(descriptionData);
    }

    @Override
    protected void initMenuData() {
        super.initMenuData();
        types.add(new MenuItem(8, "Change Description Spacing"));
        types.add(new MenuItem(9, "Change Description Size"));
        types.add(new MenuItem(10, "Change Description Color"));
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        super.onOptionsItemSelected(item);

        switch (item.getId()) {
            case 8:
                stateProgressBar.setDescriptionTopSpaceIncrementer(10f);
                break;
            case 9:
                stateProgressBar.setStateDescriptionSize(18f);
                break;
            case 10:
                stateProgressBar.setCurrentStateDescriptionColor(ColorUtils.colorResToColor(getContext(),
                        ResourceTable.Color_description_foreground_color).getValue());
                stateProgressBar.setStateDescriptionColor(ColorUtils.colorResToColor(getContext(),
                        ResourceTable.Color_description_background_color).getValue());
                break;
        }

        return true;
    }
}
